package com.example.demo.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

	@Autowired
	private TokenCheckInterceptor tokenCheckInterceptor;
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
//		super.addInterceptors(registry);
		registry
			.addInterceptor(tokenCheckInterceptor)
			.excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**","/tokenFailer/**");
	}
}
